﻿namespace Dsl.Ped.Framework.Messages
{
    /// <summary>
    /// Message sent to notify the host application that an error occured 
    /// in the editor. Hosting application can handle this message and react properly.
    /// For instance, it can display errors in the ErrorList, etc.
    /// </summary>
    public class NotifyMessage
    {
        /// <summary>
        /// Sender object of the message
        /// </summary>
        public object Sender { get; private set; }

        /// <summary>
        /// Name of the property where the error happened
        /// </summary>
        public string PropertyName { get; private set; }
        
        /// <summary>
        /// Description of the fail
        /// </summary>
        public string Description { get;  private set; }

        /// <summary>
        /// Type of the error 
        /// </summary>
        public NotifyType Type { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="NotifyMessage"/> class.
        /// </summary>
        /// <param name="sender">The sender object of the message</param>
        /// <param name="propertyName">The name of a property where the error happened</param>
        /// <param name="description">The description of a fail</param>
        /// <param name="type">The type of the message</param>
        public NotifyMessage(object sender, string propertyName, string description, NotifyType type)
        {
            this.Sender = sender;
            this.PropertyName = propertyName;
            this.Description = description;
            this.Type = type;
        }
    }

    /// <summary>
    /// Type of the message that characterize the fail
    /// </summary>
    public enum NotifyType
    {
        Info,
        Warning,
        Error
    }
}
